/*
 * @Author: chunlai
 * @Date: 2025-07-18 14:44:54
 * @LastEditTime: 2025-07-18 15:01:57
 * @LastEditors: minsheng_insurance_agency_zhoucl
 * @FilePath: \02.bldinsure\src\translate\validate\xubao.js
 * @Description: 续保规则校验
 */
import { createResult } from "./customer.js";
import constantRules from "@/methods/rules.js";
const { regexMap } = constantRules;
export const validXuBaoInfo = (strModel, formData) => {
  if (strModel.renewFlag !== undefined) {
    if (formData.renewFlag == "") {
      return createResult(false, "请确认是否自动申请续保", "renewFlag");
    }
  }
  if (formData.renewFlag == "-1") {
    if (strModel.bankAccNo !== undefined) {
      if (formData.bankAccNo == "") {
        return createResult(false, "请填写续保银行账号", "bankAccNo");
      }
    }
    if (strModel.firBankMobile !== undefined) {
      if (formData.firBankMobile == "") {
        return createResult(false, "请填写续保银行预留手机号", "firBankMobile");
      }
      if (!regexMap.PHONE.test(formData.firBankMobile)) {
        return createResult(false, `预留手机号格式错误`, "firBankMobile");
      }
    }
  }
  return { status: true };
};
